package error

import (
	"net/http"
	"github.com/emicklei/go-restful/v3"
)

// HandleInternalError writes the given error to the response and sets appropriate HTTP status headers.
func HandleInternalError(response *restful.Response, err error) {
	statusCode := http.StatusInternalServerError

	response.AddHeader("Content-Type", "text/plain")
	response.WriteErrorString(statusCode, err.Error()+"\n")
}